<?php
/**
 * 班级管理显示
 */
include "../util/DBUtil.php";
$sql = "select * from tb_grade";
$db = new DBUtil();
$result = $db->query($sql);//存储结果集
?>

<link rel="stylesheet" href="../css/bootstrap.min.css">
<table class="table table-striped">
    <tr>
        <th>ID</th>
        <th>班级</th>
        <th class="<?php echo $login_type!=1? 'hidden':''?>">编辑</th>
    </tr>
    <?php
    foreach ($result as $item){
        ?>
        <tr>
            <td><?php echo $item['id']?></td>
            <td><?php echo $item['grade']?></td>
            <td class="<?php echo $login_type!=1? 'hidden':''?>">
                <a href="../view/edit_grade.php?id=<?php echo $item['id']?>&flag=0" target="info">
                    <button class="btn btn-primary">修改</button>
                </a>
                <a href="../view/edit_grade.php?id=<?php echo $item['id']?>&flag=1" target="info">
                    <button onclick="alert('是否删除？')" class="btn btn-danger">删除</button>
                </a>
            </td>
        </tr>
        <?php
    }
    ?>
</table>

